package com.thb.pay.api.sys;


import com.thb.pay.api.sys.fallback.SysUserServiceApiFallbackFactory;
import com.thb.pay.api.sys.vo.req.SysUserPageReq;
import com.thb.pay.api.sys.vo.req.SysUserReq;
import com.thb.pay.api.sys.vo.req.SysUserRoleReq;
import com.thb.pay.api.sys.vo.resp.SysUserRoleVo;
import com.thb.pay.api.sys.vo.resp.SysUserVo;
import com.thb.pay.core.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 系统-用户表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@FeignClient(value = "pay-service", fallbackFactory = SysUserServiceApiFallbackFactory.class)
@RequestMapping("/sysUserApi")
public interface SysUserServiceApi {

    @RequestMapping(value = "/findPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    PageResult<SysUserVo> findPage(@RequestBody SysUserPageReq pageReq);

    @RequestMapping(value = "/addUser", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void addUser(@RequestBody SysUserReq sysUser);

    @RequestMapping(value = "/updateUser", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void updateUser(@RequestBody SysUserReq sysUser);

    @RequestMapping(value = "/getByUserId", method = RequestMethod.GET)
    SysUserVo getByUserId(@RequestParam("userId") Long userId);

    @RequestMapping(value = "/getByUserName", method = RequestMethod.GET)
    SysUserVo getByUserName(@RequestParam("userName") String userName);

    @RequestMapping(value = "/deleteBatchUserIds", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void deleteBatchUserIds(@RequestBody List<Long> userIds);

    @RequestMapping(value = "/addUserRoles", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    void addUserRoles(@RequestBody SysUserRoleReq userRoleReq);

    @RequestMapping(value = "/findUserRolesByUserId", method = RequestMethod.GET)
    List<SysUserRoleVo> findUserRolesByUserId(@RequestParam("userId") Long userId);
}
